<template>
  <div class="app-container">
    <el-card class="step-card">
      <el-steps 
        :active="active" 
        finish-status="success" 
        align-center
        class="custom-steps"
      >
        <el-step 
          title="任务基本信息" 
          icon="Document"
          description="配置任务的基础信息"
        ></el-step>
        <el-step 
          title="任务章节配置" 
          icon="Setting"
          description="设置章节内容"
        ></el-step>
        <el-step 
          title="任务章节审核" 
          icon="Check"
          description="审核任务最终效果"
        ></el-step>
      </el-steps>
    </el-card>

    <div class="step-content">
      <taskAudit v-if="active === 0"></taskAudit>
      <taskConfig v-if="active === 1"></taskConfig>
      <taskCreate v-if="active === 2"></taskCreate>
    </div>

    <div class="step-buttons">
      <el-button 
        @click="prev" 
        v-if="active > 0"
        :icon="ArrowLeft"
        class="prev-btn"
      >上一步</el-button>
      <el-button 
        type="primary" 
        @click="next" 
        v-if="active < 2"
        class="next-btn"
      >下一步<el-icon class="el-icon--right"><ArrowRight /></el-icon></el-button>
    </div>
  </div>
</template>

<script setup>
import { ref } from 'vue'
import { ArrowLeft, ArrowRight } from '@element-plus/icons-vue'
import taskAudit from "./taskAudit.vue"
import taskConfig from "./taskConfig.vue"
import taskCreate from "./taskCreate.vue"

const active = ref(0)

const next = () => {
  if (active.value < 2) active.value++
}

const prev = () => {
  if (active.value > 0) active.value--
}
</script>

<style scoped lang="scss">
.app-container {
  padding: 20px;
  background-color: #f5f7fa;
  height: calc(100vh - 84px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.step-card {
  margin-bottom: 10px;  // 减小底部间距
  border-radius: 8px;
  box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
  flex-shrink: 0;
  
  .custom-steps {
    padding: 10px 0;  // 减小上下内边距
    
    :deep(.el-step__title) {
      font-size: 14px;  // 减小标题字号
      font-weight: 500;
      margin-top: 6px;  // 调整标题间距
    }
    
    :deep(.el-step__description) {
      font-size: 12px;  // 减小描述文字字号
      color: #909399;
      margin-top: 3px;  // 调整描述文字间距
      line-height: 1.2;  // 减小行高
    }
    
    :deep(.el-step__icon) {
      width: 32px;  // 减小图标尺寸
      height: 32px;
    }

    :deep(.el-step__line) {
      top: 16px;  // 调整连接线位置
    }
  }
}

.step-content {
  margin: 10px 0;  // 减小上下间距
  flex: 1;
  border-radius: 8px;
  overflow: hidden;
  padding:5px 0;
}

.step-buttons {
  text-align: center;
  margin-top: 20px;
  flex-shrink: 0;
  padding-bottom: 20px;
  
  .prev-btn, .next-btn {
    min-width: 120px;
    padding: 12px 20px;
    font-size: 14px;
    border-radius: 4px;
    transition: all 0.3s;
    
    &:hover {
      transform: translateY(-2px);
    }
  }
  
  .prev-btn {
    margin-right: 20px;
  }
  
  .next-btn {
    background: linear-gradient(to right, #409eff, #67c23a);
    border: none;
    
    &:hover {
      background: linear-gradient(to right, #66b1ff, #85ce61);
    }
  }
}
</style>
